<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网络新闻分析系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            padding-top: 20px;
            padding-bottom: 20px;
            background-color: #f8f9fa;
        }
        .card {
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }
        .card-title {
            font-weight: bold;
        }
    </style>
</head>
<body>
<div class="container">
    <header class="mb-4">
        <nav class="navbar navbar-expand-lg navbar-light bg-light">
            <div class="container-fluid">
                <a class="navbar-brand" href="/">网络新闻分析系统</a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNav">
                    <ul class="navbar-nav me-auto">
                        <li class="nav-item">
                            <a class="nav-link" href="/">首页</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/news">浏览新闻</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" th:href="@{/analysis/category}">数据分析</a>
                        </li>
                        <li class="nav-item" sec:authorize="hasRole('ADMIN')">
                            <a class="nav-link" href="/admin/dashboard">管理控制台</a>
                        </li>
                    </ul>
                    <div class="d-flex">
                        <ul class="navbar-nav">
                            <li class="nav-item" sec:authorize="!isAuthenticated()">
                                <a class="nav-link" href="/login">登录</a>
                            </li>
                            <li class="nav-item" sec:authorize="!isAuthenticated()">
                                <a class="nav-link" href="/register">注册</a>
                            </li>
                            <li class="nav-item" sec:authorize="isAuthenticated()">
                                <span class="nav-link">欢迎, <span sec:authentication="name"></span></span>
                            </li>
                            <li class="nav-item" sec:authorize="isAuthenticated()">
                                <a class="nav-link" href="javascript:document.getElementById('logout-form').submit();">退出</a>
                                <form id="logout-form" action="/logout" method="post" style="display: none;">
                                    <input type="hidden" th:name="${_csrf != null ? _csrf.parameterName : ''}"
                                           th:value="${_csrf != null ? _csrf.token : ''}"/>
                                </form>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </nav>
    </header>

    <main>
        <div class="row">
            <div class="col-md-12">
                <h1 class="mb-4">欢迎使用网络新闻分析系统</h1>
                <p class="lead">这是一个基于网络爬虫的新闻分析系统，提供新闻采集、分类、情感分析和热点发现等功能。</p>
            </div>
        </div>

        <div class="row mt-4">
            <div class="col-md-4">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">新闻浏览</h5>
                        <p class="card-text">浏览系统中的新闻数据</p>
                        <a href="/news" class="btn btn-primary">进入</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">热点分析</h5>
                        <p class="card-text">查看热点新闻和趋势分析</p>
                        <a href="/analysis/hot" class="btn btn-info">进入</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">数据分析</h5>
                        <p class="card-text">查看新闻分类和情感分析结果</p>
                        <a href="/analysis/category" class="btn btn-success">进入</a>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <footer class="mt-5 pt-5 text-muted text-center">
        <p>&copy; 2025 网络新闻分析系统</p>
    </footer>
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>